package com.apes.auto.autoparts.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 行为纪律表
 * Created by lishikun on 2021/4/26 17:37
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = BehaviorRecord.CONST_TABLE_NAME)
public class BehaviorRecord  extends BaseModel {
    public static final String CONST_TABLE_NAME = "auto_behavior_record";
    @Id
    @Comment("编码")
    @Column(name = "id", nullable = false, length = 120)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "行为记录表", padding = 8)
    private String id;

    @Comment("批次号")
    @Column(name = "batch", length = 120)
    private String batch;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "operating_type", referencedColumnName = "id")
    @Comment("操作类型")
    private Enumeration operatingType; //操作类型

    @Comment("操作日期")
    @Column(name = "operating_data")
    private Date operatingData;

    @Comment("操作人编码")
    @Column(name = "user_id")
    private String userId;

    @Comment("操作人名称")
    @Column(name = "user_name")
    private String userName;

    @Comment("部门编码")
    @Column(name = "dept_id")
    private String deptId;

    @Comment("部门名称")
    @Column(name = "dept_name")
    private  String deptName;

    @Comment("车牌")
    @Column(name = "license")
    private  String license;

    @Comment("车架号")
    @Column(name = "vin")
    private  String vin;

    @Comment("输入文本")
    @Column(name = "input_text")
    private String inputText;

    @Comment("标签文本")
    @Column(name = "tag_text")
    private String tagText;

    @Comment("搜索类型")
    @Column(name = "search_type")
    private String searchType;

    @Column(name="result_type")
    @Comment("返回类型")
    String resultType;
    @Column(name="result_data", columnDefinition =  ApesConst.FIELD_BOOLEAN)
    @Comment("返回结果")
    Boolean resultData;

    @Column(name = "Inventory_commodity",  columnDefinition =  ApesConst.FIELD_BOOLEAN)
    @Comment("库存商品")
    private Boolean inventoryCommodity;

    @Column(name = "ZP_commodity",  columnDefinition =  ApesConst.FIELD_BOOLEAN)
    @Comment("兆配商品")
    private Boolean ZPCommodity;

    @Column(name = "universal_commodity",  columnDefinition =  ApesConst.FIELD_BOOLEAN)
    @Comment("通用商品")
    private Boolean universalCommodity;
}
